<template>
	<uni-popup ref="popup" type="center">
		<view class="active-rules-popup">
			<view class="active-rules-content">
				<view class="rules-text-b">NABERCAT</view>
				<view class="rules-text-s">买猫就选nabercat，更放心</view>
				<view class="rules-box">
					<view class="rules-title">活动规则</view>
					<view class="rules-list">
						<view class="rules-item">
							<view class="rules-h1">【活动时间】</view>
							<view class="rules-neirong">{{ rules.time }}</view>
						</view>
						<view class="rules-item">
							<view class="rules-h1">【活动玩法】</view>
							<view class="rules-neirong">{{ rules.info }}</view>
						</view>
						<view class="rules-item">
							<view class="rules-h1">【活动规则】</view>
							<view class="rules-neirong">{{ rules.rule }}</view>
						</view>
					</view>
				</view>
			</view>
			<icon class="close-icon" @click="close"></icon>
		</view>
	</uni-popup>
</template>

<script>
import { freeCatRules } from '@/api/active.js';
export default {
	data() {
		return {
			rules: {} //规则
		};
	},
	created() {
		this.freeCatRules();
	},
	methods: {
		// 获取活动详情
		async freeCatRules() {
			const res = await freeCatRules();
			this.rules = res;
		},
		open() {
			this.$refs.popup.open();
		},
		close() {
			this.$refs.popup.close();
		}
	}
};
</script>

<style scoped lang="scss">
.active-rules-popup {
	width: 560rpx;
	height: 906rpx;
	background: url(https://nabercat.oss-cn-hangzhou.aliyuncs.com/acat-xcx/active-popup-img1.png) no-repeat;
	background-size: cover;
	position: relative;
	.active-rules-content {
		display: flex;
		flex-direction: column;
		align-items: center;
		padding: 42rpx 40rpx 34rpx;
		.rules-text-b {
			font-size: 50rpx;
			font-weight: 600;
			color: #ffffff;
		}
		.rules-text-s {
			font-size: 20rpx;
			color: #ffffff;
		}
		.rules-box {
			width: 100%;
			height: 708rpx;
			background: #ffffff;
			border-radius: 20rpx;
			margin-top: 24rpx;
			padding: 36rpx 10rpx 34rpx;
			box-sizing: border-box;
			overflow-y: auto;
			.rules-title {
				font-size: 36rpx;
				font-weight: 600;
				color: #171717;
				margin-bottom: 32rpx;
				text-align: center;
			}
			.rules-list {
				.rules-item {
					margin-bottom: 16rpx;
					.rules-h1 {
						font-size: 28rpx;
						font-weight: 500;
						color: #fa8384;
						margin-bottom: 4rpx;
					}
					.rules-neirong {
						font-size: 24rpx;
						color: #666666;
					}
				}
			}
		}
	}
	.close-icon {
		display: block;
		width: 58rpx;
		height: 56rpx;
		background: url(https://nabercat.oss-cn-hangzhou.aliyuncs.com/acat-xcx/active-close-icon.png) no-repeat;
		background-size: cover;
		position: absolute;
		bottom: -96rpx;
		left: 50%;
		transform: translateX(-50%);
	}
}
</style>
